package actionScripts.business
{
	import mx.rpc.remoting.RemoteObject;
	
	public class SingletonService
	{
		//---------------------
		// PRIVATE VARIABLES
		//---------------------
		private static var _instance : SingletonService;
		
		public var LARemoteService :RemoteObject;
		
		public function SingletonService()
		{
			
			if( _instance != null ) {
				throw new Error( "This is a singleton class.use getInstance() instead." );
			}
			_instance = this;
			prepareAllServices();
		}
		
		/**
		 * Returns the Singlton Instance
		 */
		public static function getInstance() : SingletonService {
			
			if ( _instance == null ) {
				_instance = new SingletonService();
				
			}
			return _instance;
		}
		
		private function prepareAllServices():void {
			LARemoteService = new RemoteObject();
			LARemoteService.endpoint    = "http://localhost:8180/homeorganiser/messagebroker/amf";
			LARemoteService.destination = "homeorgService";
		}
		
	}
}